(function(){

$(function(){
	
let app = new Vue({
	el: "#app",
	data(){
		return {
			Room: null,
			InputRoom: ""
		};
	},
	created(){
		this.Room = GetUrlParameter("room");
	},
	computed: {
		Check(){
			if(this.Room){
				return true;
			}
			if(this.InputRoom.match(/^[0-9A-Z]{2}[0-9]{4}$/)){
				return true;
			}
			return false;
		}
	},
	watch:{
		InputRoom(val){
			val = val.toUpperCase();
			this.InputRoom = val;
		}
	},
	methods: {
		Join(){
			let room = this.Room;
			if(!room){
				room = this.InputRoom;
			}
			location.href = `game.html?room=${room}`
		}
	}
});
	
});

})();